﻿using DocumentFormat.OpenXml.Wordprocessing;

namespace Tatibah
{
    /// <summary>
    /// Base class for Paragraph Formatting used by the Paragraph class and Style class
    /// </summary>
    public class BaseParagraphFormatting : BaseTextFormatting
    {
       
        /// <summary>
        /// SpacingBefore units are Dxa. To convert from Pt use points function
        /// </summary>
        public uint SpacingBefore { get; set; }
        /// <summary>
        /// SpacingAfter units are Dxa. To convert from Pt use points function/// 
        /// </summary>
        public uint SpacingAfter { get; set; }

        /// <summary>
        /// Line Spacing units are Dxa
        /// </summary>
        public uint LineSpacing { get; set; }

        /// <summary>
        /// The line spacing within the paragaph. Default value Auot
        /// </summary>
        public LineSpacingRuleValues LineSpacingRule { get; set; }

        /// <summary>
        /// Ignore spacing between paragraphs of the same style.
        /// </summary>
        public bool? NoSpaceBetweenParagraphsOfSameStyle { get; set; }

/// <summary>
        /// Left paragrap indentation Units Dxa 
        /// </summary>
        public uint LeftIndentation { get; set; }

        /// <summary>
        /// Right paragrap indentation Units Dxa 
        /// </summary>
        public uint RightIndentation { get; set; }

        /// <summary>
        /// Paragraph justification. Default left justified.
        /// </summary>
        public JustificationValues Alignment = JustificationValues.Left;

        private uint firstLineIndentation = 0;
        private uint hangingIndentation = 0;

        /// <summary>
        /// Internal use.
        /// </summary>
        public BaseParagraphFormatting()
        {
            // Set the public Properties with a {set; get;}
            SpacingBefore = 0;
            SpacingAfter = 0;
            LineSpacing = 0;
            LineSpacingRule = LineSpacingRuleValues.Auto;
            NoSpaceBetweenParagraphsOfSameStyle = null;
            LeftIndentation = 0;  
            RightIndentation = 0; 
        }
        #region  P R O P E R T I E S
        /// <summary>
        /// Units are in Dxas. FirstLineIndentation and HangingIndentation are mutually exclusive.
        /// </summary>
        public uint FirstLineIndentation
        {
            get { return firstLineIndentation; }
            set
            {
               
                hangingIndentation = 0;
                firstLineIndentation = value;
            }
        }

        /// <summary>
        /// Units are in Dxas. FirstLineIndentation and HangingIndentation are mutually exclusive.
        /// </summary>
        public uint HangingIndentation
        {
            get { return hangingIndentation; }
            set
            {
               
                firstLineIndentation = 0;
                hangingIndentation = value;
            }
        }
        #endregion  P R O P E R T I E S


    }
}
